package com.andaily.domain.log;

import com.andaily.domain.AbstractDomain;
import com.andaily.domain.user.User;

/**
 * @author Shengzhao Li
 */
public class LogType extends AbstractDomain {

    private String name;
    /**
     * Log type description, optional
     */
    private String description;
    /**
     * The log type creator.<br/>
     * Null is default LogType.
     */
    private User creator;

    //It is selected type or not when add  log;  one user only have one is selected(value = true)
    private boolean selectedType;

    public LogType() {
    }

    public LogType(String name, String description) {
        this.name = name;
        this.description = description;
    }

    public LogType(String name, String description, User creator) {
        this(name, description);
        this.creator = creator;
    }

    public boolean defaultType() {
        return creator == null;
    }

    public User creator() {
        return creator;
    }

    public String name() {
        return name;
    }

    public String description() {
        return description;
    }

    public void updateCreator(User creator) {
        this.creator = creator;
    }

    public void update(String name, String description) {
        this.name = name;
        this.description = description;
    }

    public boolean selectedType() {
        return selectedType;
    }

    public void updateSelectType(boolean selectedType) {
        this.selectedType = selectedType;
    }
}
